<?php

namespace mpend\controllers;

use Yii;
use mpend\components\Controller;
use common\exceptions\ModelHttpException;
use mpend\models\DeviceForm;

/**
 * Site controller
 * Descriptions
 *
 * @author emhome <emhome@163.com>
 * @since 1.0
 * @date date time
 */
class TestController extends Controller
{

//    public $closeCheckAuthent = true;
    public $filterAccessToken = false;

    /**
     * Declares the allowed HTTP verbs.
     * Please refer to [[VerbFilter::actions]] on how to declare the allowed verbs.
     * @return array the allowed HTTP verbs.
     */
    protected function verbs()
    {
        return [
            '*' => ['GET'],
            'list' => ['GET', 'POST'],
            'test' => ['POST']
        ];
    }

    /**
     * Displays homepage.
     * @return mixed
     */
    public function actionIndex()
    {
        return '鲁能体育开放平台';
    }

    /**
     * 获取当前应用版本信息
     * @return mixed
     */
    public function actionList()
    {
        $model = new \mpend\models\test\MatchSearch();
        $model->load(Yii::$app->request->getQueryParams(), '');
        return $model->search();
    }

    public function actionTest()
    {
        $params = Yii::$app->request->post();
        return Yii::$app->security->encryptDataByKey($params['access_token']);
    }

}
